package net.j4love.spring.boot.webmvc.web;


import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

/**
 * @author He Peng
 * @create 2017-05-19 17:58
 * @update 2017-05-19 17:58
 * @see
 */
// 没有修改 DispatcherServlet 的 urlPatterns 现在这个用不了
@WebServlet(name = "MyServlet" , loadOnStartup = 666 ,
        urlPatterns = "/my/servlet" , asyncSupported = true)
public class MyServlet implements Servlet {

    private ServletConfig servletConfig;

    @Override
    public void init(ServletConfig config) throws ServletException {
        this.servletConfig = config;
        System.err.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%% \r\n MyServlet init");
    }

    @Override
    public ServletConfig getServletConfig() {
        return this.servletConfig;
    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {

        System.err.println("####################### \r\n MyServlet service");

    }

    @Override
    public String getServletInfo() {
        return MyServlet.class.getName();
    }

    @Override
    public void destroy() {
        System.err.println("****************************** \r\n MyServlet destroy");

    }
}
